package lu.med.praxiswahl.wahlumed.client.wclient;

import java.awt.BorderLayout;

import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.SwingUtilities;

import java.awt.Color;
import java.awt.SystemColor;
import java.awt.Font;

import lu.med.praxiswahl.wahlumed.client.utilities.ImageModule;

/**
 * 
 * @author Lars Roth
 * 
 */
@SuppressWarnings("serial")
public class SplashLoaderPanel extends JPanel {
	private JProgressBar pBar;

	public SplashLoaderPanel() {
		super(new BorderLayout());
		setBackground(Color.LIGHT_GRAY);
		ImageModule img = new ImageModule(/*
										 * getClass().getResource("../logo.jpg").
										 * getFile()
										 */);

		img.setBackground(SystemColor.activeCaption);
		this.add(img, BorderLayout.CENTER);
		pBar = new JProgressBar();
		pBar.setForeground(SystemColor.activeCaption);
		pBar.setFont(new Font("Verdana", Font.BOLD, 12));
		pBar.setStringPainted(true);
		this.add(pBar, BorderLayout.SOUTH);
	}

	public void updateProgressBar(final int val) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				pBar.setValue(val);
			}
		});
	}
}